package com.feiyu.sys.utils

import org.apache.shiro.crypto.hash.Md5Hash
/**
 * Created by zdy on 2017/11/25.
 */
class PasswordUtils {
    /** 迭代次数 */
    static final int ITERATIONS = 6

    /** 盐值数位 */
    static final int SALT_NUMBER = 6;
    /**
     * 字符串加密函数MD5实现
     * @param password
     * @param salt
     * @return
     */
    static String getMd5(String password, String salt) {
        return new Md5Hash(password, salt, ITERATIONS).toString()
    }

    /**
     * 获得密码盐值
     * @return
     */
    static String getSalt() {
        return RandomUtils.getString(SALT_NUMBER)
    }
}
